package one.stand.controller;

import one.stand.model.FinanceModel;
import one.stand.model.ResultModel;
import one.stand.request.*;
import one.stand.response.AdminResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 首页
 *
 * @author Administrator
 */
@RestController
@RequestMapping("index")
public class IndexController extends BaseController {

    /**
     * 登录
     *
     * @param request
     * @return
     */
    @PostMapping("login")
    public ResultModel<AdminResponse> login(@RequestBody AdminRequest request) {
        return companyService.login(request);
    }

    /**
     * 查询管理员操作记录列表
     *
     * @param request
     * @return
     */
    @PostMapping("selectAdminRecordList")
    public ResultModel<Map<String, Object>> selectAdminRecordList(@RequestBody AdminRecordRequest request) {
        return companyService.selectAdminRecordList(request);
    }

    /**
     * 检查token
     *
     * @param token
     * @return
     */
    @PostMapping("checkingToken")
    public ResultModel<Boolean> checkingToken(@RequestParam(value="token") String token) {
        return companyService.checkingToken(token);
    }

    /**
     * 企业首页数据统计
     *
     * @param request
     * @return
     */
    @PostMapping("indexData")
    public ResultModel<FinanceModel> indexData(@RequestBody FinanceRequest request) {
        return companyService.indexData(request);
    }

    /**
     * 企业首页数据统计折线图
     *
     * @param request
     * @return
     */
    @PostMapping("newCountList")
    public ResultModel<Map<String, List<Map<String, Object>>>> newCountList(@RequestBody FinanceRequest request) {
        return companyService.newCountList(request);
    }

    /**
     * 数据中心-数据概况
     *
     * @param request
     * @return
     */
    @PostMapping("dataCenter")
    public ResultModel<Map<String, Object>> dataCenter(@RequestBody FinanceRequest request) {
        return companyService.dataCenter(request);
    }

    /**
     * 数据中心-用户增长情况
     *
     * @param request
     * @return
     */
    @PostMapping("newUserCountList")
    public ResultModel<List<Map<String, Object>>> newUserCountList(@RequestBody FinanceRequest request) {
        return companyService.newUserCountList(request);
    }

    /**
     * 数据中心-使用人数增长情况
     *
     * @param request
     * @return
     */
    @PostMapping("userUseCountList")
    public ResultModel<List<Map<String, Object>>> userUseCountList(@RequestBody FinanceRequest request) {
        return companyService.userUseCountList(request);
    }

    /**
     * 用户画像-性别分布
     *
     * @param request
     * @return
     */
    @PostMapping("userSexCount")
    public ResultModel<List<Map<String, Object>>> userSexCount(@RequestBody FinanceRequest request) {
        return companyService.userSexCount(request);
    }
}
